<?php
declare (strict_types = 1);

namespace app\validate\api;

use think\Validate;

/**
 * 光遇验证器
 * Class Index
 * @package app\index\validate
 */
class Sky extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'category'    => 'require',
        'season'      => 'require',
        'type'        => 'require',
        'ancestor_id' => 'require|number',
        'date'        => 'date'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'season.require'     => 'season不可为空',
        'category.require'   => 'category不可为空',
        'type.require'       => 'type不可为空',
        'ancestor_id.number' => 'ancestor_id格式不正确',
    ];


    protected $scene = [
        'tag'      =>  ['category'],
        'season'   =>  ['season'],
        'ancestor' =>  ['category','type'],
        'detail'   =>  ['ancestor_id'],
        'date'     =>  ['date'],
    ];

}
